import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;

import javax.swing.*;

import com.jgoodies.forms.layout.*;
/*
 * Created by JFormDesigner on Mon Apr 18 21:21:18 CDT 2011
 */



/**
 * @author Becca Emrick
 */
public class EditorGUI extends JFrame {
//	private JButton newButton;
//	private JButton saveButton;
//	private JButton openButton;
//	private JButton playButton;
	
	public EditorGUI() {
		initComponents();
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}

	private void addStraightPart(ActionEvent e) {
		System.out.println("Render Straight Piece");
//		GameManager.GM.glWindow.renderStraightPiece();
	}

	private void addLeftCurve(ActionEvent e) {
		System.out.println("Render Left Curve");
//		GameManager.GM.glWindow.renderLeftCurve();
	}

	private void addRightCurve(ActionEvent e) {
		System.out.println("Render Right Curve");
//		GameManager.GM.glWindow.renderRightCurve();
	}

	private void addCurveUpPart(ActionEvent e) {
		System.out.println("Render Up Curve");
//		GameManager.GM.glWindow.renderUpCurve();
	}

	private void addCurveDownPart(ActionEvent e) {
		System.out.println("Render Down Curve");
//		GameManager.GM.glWindow.renderDownCurve();
	}

	private void saveCoaster(ActionEvent e) {
		System.out.println("Save Coaster");
//		GameManager.GM.database.saveRollerCoaster(GameManager.GM.getCoaster());
	}

	private void openCoaster(ActionEvent e) {
		System.out.println("Open Coaster");
//		ArrayList<String> coasters = GameManager.GM.database.getAllCoasterNames();
		ArrayList<String> coasters = createFakeCoasterList(); //delete me when database is working
//		this.setVisible(false);
		GameManager.GM.openWindow.addCoasterList(coasters);
		GameManager.GM.openWindow.setVisible(true);
		GameManager.GM.openWindow.requestFocus();
	}

	private ArrayList<String> createFakeCoasterList() {
		ArrayList<String> coasters = new ArrayList<String>();
		coasters.add("Clanging Fred");
		coasters.add("Business Casual");
		coasters.add("Awww Hell Naw");
		coasters.add("Grrr! Feeble Air");
		coasters.add("A Chemical Milk");
		coasters.add("Filched Racism");
		return coasters;
	}

	private void playCoaster(ActionEvent e) {
		System.out.println("Watch Coaster Go!");
//		GameManager.GM.glWindow.runCoaster();
	}

	private void initComponents() {
		// JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
		// Generated using JFormDesigner Evaluation license - Becca Emrick
		newButton = new JButton();
		saveButton = new JButton();
		openButton = new JButton();
		playButton = new JButton();
		button1 = new JButton();
		straightPartButton = new JButton();
		leftPartButton = new JButton();
		RightPartButton = new JButton();
		button2 = new JButton();
		button13 = new JButton();
		curveUpButton = new JButton();
		curveDownButton = new JButton();
		button20 = new JButton();
		button3 = new JButton();
		button25 = new JButton();
		button6 = new JButton();
		button17 = new JButton();
		button21 = new JButton();
		button10 = new JButton();
		button14 = new JButton();
		button7 = new JButton();
		button18 = new JButton();
		button22 = new JButton();
		button11 = new JButton();
		button26 = new JButton();
		button8 = new JButton();
		button23 = new JButton();
		button24 = new JButton();
		button12 = new JButton();
		button9 = new JButton();
		CellConstraints cc = new CellConstraints();

		//======== this ========
		Container contentPane = getContentPane();
		contentPane.setLayout(new FormLayout(
			"5*(default, $lcgap), 31dlu",
			"8*(default, $lgap), default"));

		//---- newButton ----
		newButton.setIcon(new ImageIcon(getClass().getResource("/newRC.png")));
		contentPane.add(newButton, cc.xy(1, 1));

		//---- saveButton ----
		saveButton.setIcon(new ImageIcon(getClass().getResource("/save_icon1.gif")));
		saveButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				saveCoaster(e);
			}
		});
		contentPane.add(saveButton, cc.xy(3, 1));

		//---- openButton ----
		openButton.setIcon(new ImageIcon(getClass().getResource("/open2.png")));
		openButton.setSelectedIcon(null);
		openButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				openCoaster(e);
			}
		});
		contentPane.add(openButton, cc.xy(5, 1));

		//---- playButton ----
		playButton.setIcon(new ImageIcon(getClass().getResource("/playButton.png")));
		playButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				playCoaster(e);
			}
		});
		contentPane.add(playButton, cc.xy(11, 1));

		//---- button1 ----
		button1.setIcon(new ImageIcon(getClass().getResource("/BI.png")));
		contentPane.add(button1, cc.xy(1, 3));

		//---- straightPartButton ----
		straightPartButton.setText("Straight");
		straightPartButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				addStraightPart(e);
			}
		});
		contentPane.add(straightPartButton, cc.xy(3, 3));

		//---- leftPartButton ----
		leftPartButton.setText("Left ");
		leftPartButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				addLeftCurve(e);
			}
		});
		contentPane.add(leftPartButton, cc.xy(5, 3));

		//---- RightPartButton ----
		RightPartButton.setText("Right");
		RightPartButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				addRightCurve(e);
			}
		});
		contentPane.add(RightPartButton, cc.xy(7, 3));

		//---- button2 ----
		button2.setIcon(new ImageIcon(getClass().getResource("/FI.png")));
		contentPane.add(button2, cc.xy(9, 3));

		//---- button13 ----
		button13.setIcon(new ImageIcon(getClass().getResource("/BI.png")));
		contentPane.add(button13, cc.xy(1, 5));

		//---- curveUpButton ----
		curveUpButton.setText("Curve Up");
		curveUpButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				addCurveUpPart(e);
			}
		});
		contentPane.add(curveUpButton, cc.xy(3, 5));

		//---- curveDownButton ----
		curveDownButton.setText("Curve Down");
		curveDownButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				addCurveDownPart(e);
			}
		});
		contentPane.add(curveDownButton, cc.xy(5, 5));

		//---- button20 ----
		button20.setText("Part");
		contentPane.add(button20, cc.xy(7, 5));

		//---- button3 ----
		button3.setIcon(new ImageIcon(getClass().getResource("/FI.png")));
		contentPane.add(button3, cc.xy(9, 5));

		//---- button25 ----
		button25.setIcon(new ImageIcon(getClass().getResource("/BI.png")));
		contentPane.add(button25, cc.xy(1, 7));

		//---- button6 ----
		button6.setText("Part");
		contentPane.add(button6, cc.xy(3, 7));

		//---- button17 ----
		button17.setText("Part");
		contentPane.add(button17, cc.xy(5, 7));

		//---- button21 ----
		button21.setText("Part");
		contentPane.add(button21, cc.xy(7, 7));

		//---- button10 ----
		button10.setIcon(new ImageIcon(getClass().getResource("/FI.png")));
		contentPane.add(button10, cc.xy(9, 7));

		//---- button14 ----
		button14.setIcon(new ImageIcon(getClass().getResource("/BI.png")));
		contentPane.add(button14, cc.xy(1, 9));

		//---- button7 ----
		button7.setText("Part");
		contentPane.add(button7, cc.xy(3, 9));

		//---- button18 ----
		button18.setText("Part");
		contentPane.add(button18, cc.xy(5, 9));

		//---- button22 ----
		button22.setText("Part");
		contentPane.add(button22, cc.xy(7, 9));

		//---- button11 ----
		button11.setIcon(new ImageIcon(getClass().getResource("/FI.png")));
		contentPane.add(button11, cc.xy(9, 9));

		//---- button26 ----
		button26.setIcon(new ImageIcon(getClass().getResource("/BI.png")));
		contentPane.add(button26, cc.xy(1, 11));

		//---- button8 ----
		button8.setText("Part");
		contentPane.add(button8, cc.xy(3, 11));

		//---- button23 ----
		button23.setText("Part");
		contentPane.add(button23, cc.xy(5, 11));

		//---- button24 ----
		button24.setText("Part");
		contentPane.add(button24, cc.xy(7, 11));

		//---- button12 ----
		button12.setIcon(new ImageIcon(getClass().getResource("/FI.png")));
		contentPane.add(button12, cc.xy(9, 11));

		//---- button9 ----
		button9.setText("Add Part");
		contentPane.add(button9, cc.xy(11, 13));
		pack();
		setLocationRelativeTo(getOwner());
		// JFormDesigner - End of component initialization  //GEN-END:initComponents
	}

	// JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
	// Generated using JFormDesigner Evaluation license - Becca Emrick
	private JButton newButton;
	private JButton saveButton;
	private JButton openButton;
	private JButton playButton;
	private JButton button1;
	private JButton straightPartButton;
	private JButton leftPartButton;
	private JButton RightPartButton;
	private JButton button2;
	private JButton button13;
	private JButton curveUpButton;
	private JButton curveDownButton;
	private JButton button20;
	private JButton button3;
	private JButton button25;
	private JButton button6;
	private JButton button17;
	private JButton button21;
	private JButton button10;
	private JButton button14;
	private JButton button7;
	private JButton button18;
	private JButton button22;
	private JButton button11;
	private JButton button26;
	private JButton button8;
	private JButton button23;
	private JButton button24;
	private JButton button12;
	private JButton button9;
	// JFormDesigner - End of variables declaration  //GEN-END:variables
	
	
	}
